<?php
//error_reporting(0);
include "inc/conn.php";
include "inc/pubs.php";
include "inc/safe.php";
include "inc/sqls.php";
$th = $_COOKIE['name'];
$dn = $_COOKIE['pass'];
//判断是否记忆登陆
$re = $_GET["do"];
if($re==$ou){
}else{
if($dn == md5($th.$ao)){
$sh = 'yes';
webalert("已经登录!","index.php?tt=".$tts);
}
}
//获取用户openid
$wxPay = new WxService($appid,$appKey);
$data = $wxPay->GetOpenid();      //获取openid
$wxid = $data['openid'];
if(!$wxid){
exit("登陆失败(L2)：检查公众号配置!".json_encode($data));
}
$ba = md5($wxid.$ao); //微信ID&用户名&ip组合加密登陆
setcookie('name',$wxid,time()+60*60*12*1,"/"); //微信rt小时有效
setcookie('pass',$ba,time()+60*60*1*1,"/"); //密码1小时有效
if($re==$ou){
//访问login.php?do={conn.php里的管理员邮件}则写入你的微信ID为管理员
//重新设置管理员：删除ld.ini.php后重新操作访问以上网址
$hi = "\r\n".md5($wxid);
if(!file_exists($ld)){
$os = "成功获得权限!";
file_put_contents($ld,'<?php exit() ?>'.$hi);
}else{
$os = "权限已被领取!";
}
webalert("{$os}(L5)!","down.php?tt=".$tts);
exit();
}
//判断是否绑定
$db=ConnectMysqli::getIntance($conn);
$sql="SELECT COUNT(*) FROM `{$no}` WHERE `{$lr}`='{$wxid}'";
$sql.=" AND `{$dr}`>'{$ad}'";
$list=$db->getRow($sql);
$recs=$list['COUNT(*)'];
if($recs<1){
webalert("进入预约页面(L3)!","bang.php?tt=".$tts);
}else{
webalert("查看我的预约(L4)!","index.php?tt=".$tts);
}
/*
//记忆登录信息不入库
//$user = $wxPay->getUserInfo($data['openid'],$data['access_token']);
*/
?>